package com.baomidou.springboot.controller.user;

import com.baomidou.springboot.common.SortEnum;
import com.baomidou.springboot.service.AboutService;
import com.baomidou.springboot.service.EnvironmentService;
import com.baomidou.springboot.service.HssseService;
import com.baomidou.springboot.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/hssse")
public class HssseController {

    @Autowired
    private AboutService aboutService;
    @Autowired
    private NewsService newsService;
    @Autowired
    private HssseService hssseService;

    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    public String detail(HttpServletRequest request, String id) {
        // 关于我们子菜单
        request.setAttribute("aboutMenuList", aboutService.findBySort(SortEnum.ASC));
        // 新闻的动态子菜单
        request.setAttribute("newsMenuList", newsService.findBySort(SortEnum.ASC));
        // 列表
        request.setAttribute("hssseList", hssseService.findBySort());
        // 新闻详情
        request.setAttribute("hssse", hssseService.findById(id));
        return "user/hssse/detail";
    }
}
